$(document).ready(function () {
    $.ajax({
        type:"get",
        url:"/session/getSession",
        dataType:"json",
        success:function (res) {
            var user=res.user;
            $.ajax({
                type: "get",
                async: false,
                url: "/myCode/initMyCode",
                data: user,
                dataType: "json",
                success: function (data) {
                    for (var i in data) {
                        var html = "";
                        html += "<tr>";
                        html += "<td align='center'>" + data[i].date + "</td>";
                        html += "<td>" + data[i].content + "</td>";
                        html += "<td align='center'><input type='button' value='详情' class='toDetails'/></td>";
                        html += "<td align='center'><input type='hidden' value=" + data[i].url + "></td>";
                        html += "</tr>";
                        $("#myTable").append(html);
                        $(".toDetails").click(function () {
                            var url = $(this).parent().parent().find("td").eq(3).find("input[type=hidden]").val();
                            window.location.href = "answer.html?url=" + url;
                        })
                    }
                }
            });
        }
    })

});
